securityModule.controller("DeviceApplicationCtrl", ["$log", "$scope", "$q", "$filter", "practiceSvc", "loginContext", "deviceSvc", "dataDicSvc", function(n, t, i, r, u, f, e, o) {
    "use strict";
    var s = function() {
            o.currentOfficeWorkProviderDic.load().then(function(n) {
                n.splice(0, 0, {
                    userID: 0,
                    name: "申请员工"
                });
                t.providers = n
            })
        },
        h = function(n) {
            var r = i.defer(),
                u = t.approvalStatus,
                f = {
                    pageSize: t.pageSize,
                    pageIndex: n ? 1 : t.pageIndex,
                    applicationStartTime: t.applicationDate ? moment(t.applicationDate).format("YYYY-MM-DD") : null,
                    applicationEndTime: t.applicationDate ? moment(t.applicationDate).add(1, "day").format("YYYY-MM-DD") : null,
                    applicationUserId: t.userId && t.userId > 0 ? t.userId : null,
                    approvalStatus: u > -1 ? u : null
                };
            return r.resolve(f), r.promise
        },
        c = function(n) {
            var r = i.defer();
            return h(n).then(function(n) {
                e.searchDeviceApplication(n).success(function(n) {
                    y(n);
                    t.pageData = n;
                    r.resolve(t.pageData)
                })
            }), r.promise
        },
        l = function(n, t) {
            var r = i.defer();
            return e.approveDevice(n, t).then(function(n) {
                r.resolve(n.data)
            }), r.promise
        },
        a = function(n, t) {
            var r = i.defer();
            return e.rejectDevice(n, t).then(function(n) {
                r.resolve(n.data)
            }), r.promise
        },
        v = function(n, t) {
            var r = i.defer();
            return e.callbackDevice(n, t).then(function(n) {
                r.resolve(n.data)
            }), r.promise
        },
        y = function(n) {
            _.each(n.items, function(n) {
                n.approvalStatusStr = r("approvalStatusStr")(n.approvalStatus);
                n.applicationUser = r("toUserName")(n.applicationUserId);
                n.approvalUser = r("toUserName")(n.approvalUserId);
                n.deviceCategoryStr = r("toDeviceCategoryStr")(n.deviceCategory);
                n.deviceTypeStr = r("toDeviceTypeStr")(n.deviceType);
                n.authTypeStr = r("toDeviceAuthTypeStr")(n.authType);
                n.authScopeStr = r("toDeviceAuthScopeStr")(n.authScope);
                n.officeStr = r("toOfficeAbbr")(n.officeId)
            })
        };
    (function() {
        t.pageSize = 20;
        t.pageIndex = 1;
        t.refreshApplications = c;
        t.initDefaultData = s;
        t.approve = l;
        t.reject = a;
        t.callback = v
    })()
}]);
securityModule.controller("DeviceManagementEditCtrl", ["$log", "$q", "$scope", "$modalInstance", "host", "officeSvc", "officeSelectorUtil", "multiOfficeDataDic", "loginContext", "aresNotification", "deviceSvc", "eventAggregator", function(n, t, i, r, u, f, e, o, s, h, c) {
    "use strict";
    var a = function() {
            r.dismiss()
        },
        l = function(n) {
            var t = n || s.officeId;
            o.loadDic(t, "currentOfficeWorkProviderDic").then(function(n) {
                n && (i.providers = _.filter(n, function(n) {
                    return n.userID > 0 && !_.find(i.newProviders, {
                        userId: n.userID
                    }) ? !0 : !1
                }))
            })
        },
        v = function() {
            var n = t.defer();
            return u.id ? c.getDeviceById(u.id).success(function(t) {
                i.device = t;
                i.newProviders = t.deviceUsers || [];
                l();
                n.resolve(!0)
            }) : (console.error("没有接收到设备Id"), h.error("加载失败")), n.promise
        },
        y = function() {
            p();
            c.updateDevice(i.device).success(function(n) {
                i.device = n;
                r.close(n)
            })
        },
        p = function() {
            if (i.device.authScope == 2) {
                var n = [];
                angular.forEach(i.newProviders, function(t) {
                    n.push({
                        deviceId: i.device.id,
                        isAllowed: !0,
                        userId: t.userID || t.userId
                    })
                });
                i.device.deviceUsers = n
            }
        },
        w = function() {
            s.isRootGroup && (i.selectedOfficeIdsArray = [s.officeId], f.getSelfAndChildOfficesByGroupId(s.officeId, !1).success(n => {
                i.officeTreeData = e.setId(n), i.isShowOfficeSelector = !0
            }))
        },
        b = function(n) {
            if (i.selectedOfficeIdsArray = _.pluck(n, "officeId"), i.selectedOfficeIdsArray && i.selectedOfficeIdsArray.length > 0) {
                var t = i.selectedOfficeIdsArray[0];
                i.device.officeId = t;
                l(t)
            }
        };
    (function() {
        i.cancel = a;
        i.save = y;
        i.initProviders = l;
        i.initData = v;
        i.isShowOfficeSelector = !1;
        i.onOfficeSelected = b;
        w()
    })()
}]);
securityModule.controller("DeviceManagementCtrl", ["$log", "$scope", "$q", "$filter", "practiceSvc", "loginContext", "deviceSvc", function(n, t, i, r, u, f, e) {
    "use strict";
    var o = function(n) {
            var r = i.defer(),
                u = t.deviceType,
                f = {
                    pageSize: t.pageSize,
                    pageIndex: n ? 1 : t.pageIndex,
                    authType: t.authType > -1 ? t.authType : null,
                    deviceType: u > -1 ? u : null
                };
            return r.resolve(f), r.promise
        },
        s = function(n) {
            var r = i.defer();
            return o(n).then(function(n) {
                e.searchDevice(n).success(function(n) {
                    h(n);
                    t.pageData = n;
                    r.resolve(t.pageData)
                })
            }), r.promise
        },
        h = function(n) {
            _.each(n.items, function(n) {
                n.deviceStatusStr = n.isDisabled ? "停用" : "启用";
                n.registerUser = r("toUserName")(n.registerUserId);
                n.deviceCategoryStr = r("toDeviceCategoryStr")(n.deviceCategory);
                n.deviceTypeStr = r("toDeviceTypeStr")(n.deviceType);
                n.authTypeStr = r("toDeviceAuthTypeStr")(n.authType);
                n.authScopeStr = r("toDeviceAuthScopeStr")(n.authScope);
                n.officeStr = r("toOfficeAbbr")(n.officeId)
            })
        },
        c = function(n) {
            var t = i.defer();
            return e.enableDevice(n).then(function(n) {
                t.resolve(n.data)
            }), t.promise
        },
        l = function(n) {
            var t = i.defer();
            return e.disableDevice(n).then(function(n) {
                t.resolve(n.data)
            }), t.promise
        };
    (function() {
        t.pageSize = 20;
        t.pageIndex = 1;
        t.loginType = 1;
        t.refreshDevice = s;
        t.enableDevice = c;
        t.disableDevice = l
    })()
}]);
securityModule.controller("LoginLogListCtrl", ["$log", "$scope", "$q", "$filter", "loginContext", "officeSvc", "officeSelectorUtil", "practiceSvc", function(n, t, i, r, u, f, e, o) {
    "use strict";
    var s = function(n) {
            var r = i.defer(),
                u = {
                    pageSize: t.pageSize,
                    pageIndex: n ? 1 : t.pageIndex,
                    state: t.state || "",
                    platform: t.platform || "",
                    action: t.action || "",
                    userId: t.userId || null,
                    startDate: t.startTime,
                    endDate: t.endTime
                };
            return t.selectedOfficeIdsArray && t.selectedOfficeIdsArray.length > 0 && (u.officeIdStr = t.selectedOfficeIdsArray[0]), r.resolve(u), r.promise
        },
        h = function(n) {
            var r = i.defer();
            return s(n).then(function(n) {
                o.searchAccountLogs(n).success(function(n) {
                    c(n);
                    t.pageData = n;
                    r.resolve(t.pageData)
                })
            }), r.promise
        },
        c = function(n) {
            angular.forEach(n.items, function(n) {
                n.recordCreatedTimeStr = moment(n.recordCreatedTime).format("YYYY-MM-DD HH:mm:ss");
                n.state = n.result == "Success" ? "成功" : "失败";
                n.actionStr = r("toLogOnActionStr")(n.action);
                n.logOnStateStr = r("toLogOnStateStr")(n.result);
                n.platformStr = r("toLogOnPlatformStr")(n.platform)
            })
        },
        l = function() {
            u.isRootGroup && u.isGroup && (t.selectedOfficeIdsArray = [u.officeId], f.getSelfAndChildOfficesByGroupId(u.officeId, !1).success(n => {
                t.officeTreeData = e.setId(n), t.isShowOfficeSelector = !0
            }))
        },
        a = function(n) {
            t.selectedOfficeIdsArray = _.pluck(n, "officeId");
            t.selectedOfficeIdsArray && t.selectedOfficeIdsArray.length > 0 && (t.initProviderDropDown(t.selectedOfficeIdsArray[0]), t.userId = null)
        };
    (function() {
        t.memoData = {};
        t.pageSize = 20;
        t.pageIndex = 1;
        t.refreshListData = h;
        t.onOfficeSelected = a;
        l()
    })()
}]);
securityModule.controller("SecurityDataSettingCtrl", ["$log", "$scope", "$q", "$filter", "enums", "officeOptionSvc", "officeSvc", "aresNotification", function(n, t, i, r, u, f, e, o) {
    "use strict";
    var s = "SensitiveFields",
        h = function() {
            f.getOfficeOption(s).then(function(n) {
                if (n) {
                    var i = JSON.parse(n);
                    i && (t.dataMasking.withPatientPhone = i.includes(u.SensitiveOption.PatientContact), t.dataMasking.withPatientIdentityCard = i.includes(u.SensitiveOption.PatientIdentityCard))
                }
            })
        },
        c = function() {
            var n = [];
            return t.dataMasking.withPatientPhone && n.push(u.SensitiveOption.PatientContact), t.dataMasking.withPatientIdentityCard && n.push(u.SensitiveOption.PatientIdentityCard), {
                optionKey: s,
                optionValue: JSON.stringify(n)
            }
        },
        l = function() {
            var n = i.defer(),
                t = c();
            return f.setOfficeOption(t.optionKey, t.optionValue).then(function(t) {
                t && o.success("保存成功！");
                n.resolve()
            }, function() {
                o.error("保存失败！");
                n.reject()
            }), n.promise
        };
    (function() {
        t.dataMasking = {};
        t.saveOption = l;
        t.initData = h
    })()
}]);
var security;
(function() {
    var n = function() {
        function n(n, t, i) {
            this.$scope = n;
            this.commonSvc = t;
            this.aresNotification = i
        }
        return n.prototype.upLoadErrorLog = function() {
            var n = this,
                t = indexedDB.open("AresLocalDatabase", 2);
            t.onsuccess = function(t) {
                var i = t.target.result,
                    r = i.transaction(["ScriptErrors"], "readwrite"),
                    u = r.objectStore("ScriptErrors");
                u.getAll().onsuccess = function(t) {
                    var r = t.target.result,
                        f = 0,
                        u;
                    r && r.length > 0 && (f = r[0].id);
                    u = r.map(function(n) {
                        return {
                            id: n.id,
                            filename: n.filename,
                            lineno: n.lineno,
                            colno: n.colno,
                            stack: n.stack,
                            message: n.message,
                            messageType: n.messageType,
                            logTime: n.logTime
                        }
                    });
                    n.commonSvc.uploadClientLog(u).then(function(t) {
                        if (t) {
                            var r = i.transaction(["ScriptErrors"], "readwrite"),
                                u = r.objectStore("ScriptErrors");
                            u.clear();
                            n.aresNotification.success("上传成功")
                        }
                    })
                }
            }
        }, n.prototype.reSetIndexedDB = function() {}, n.$inject = ["$scope", "commonSvc", "aresNotification"], n
    }();
    securityModule.controller("SecurityErrorLogCtrl", Ares.tsController(n))
})(security || (security = {}));
securityModule.controller("SecurityOperationLogListCtrl", ["$log", "$scope", "$q", "$filter", "loginContext", "operationLogsvc", "officeSvc", "officeSelectorUtil", "moduleOptionProvider", function(n, t, i, r, u, f, e, o, s) {
    "use strict";
    var h = function(n) {
            var u = i.defer(),
                r = {
                    pageSize: t.pageSize,
                    pageIndex: n ? 1 : t.pageIndex,
                    operationType: t.operationType || "",
                    moduleLevelOne: t.moduleLevelOne || "",
                    userId: t.userId || null,
                    startDate: t.startTime,
                    endDate: t.endTime
                },
                f;
            return t.moduleLevelOne || (f = _.pluck(t.logModules, "name").join(","), r.moduleScope = f), t.selectedOfficeIdsArray && t.selectedOfficeIdsArray.length > 0 && (r.officeIdStr = t.selectedOfficeIdsArray[0]), u.resolve(r), u.promise
        },
        c = function(n) {
            var r = i.defer();
            return h(n).then(function(n) {
                f.search(n).success(function(n) {
                    l(n);
                    t.pageData = n;
                    r.resolve(t.pageData)
                })
            }), r.promise
        },
        l = function(n) {
            angular.forEach(n.items, function(n) {
                n.recordCreatedTimeStr = moment(n.recordCreatedTime).format("YYYY-MM-DD HH:mm:ss");
                n.officeName = r("toOfficeAbbr")(n.officeId);
                var i = _.find(t.logModules, {
                    name: n.moduleLevelOne
                });
                n.module = i ? i.value : "";
                n.operationType == "增" ? n.operationTypeStr = "新增" : n.operationType == "删" ? n.operationTypeStr = "删除" : n.operationType == "改" ? n.operationTypeStr = "修改" : n.operationType == "查" && (n.operationTypeStr = "查看")
            })
        },
        a = function() {
            t.logModules = [{
                name: "患者基本信息",
                value: "Patient"
            }, {
                name: "查看患者",
                value: "PatientContact"
            }, {
                name: "查看网络预约患者",
                value: "AppointmentApplyPatientContact"
            }, {
                name: "预约管理",
                value: "Appointment"
            }, {
                name: "会员管理",
                value: "Membership"
            }, {
                name: "随访管理",
                value: "Followup"
            }, {
                name: "病历管理",
                value: "MedicalRecord"
            }, {
                name: "技加工",
                value: "OutProcessOrder"
            }, {
                name: "入库管理",
                value: "InventoryInOrder"
            }, {
                name: "出库管理",
                value: "InventoryOutOrder"
            }, {
                name: "调拨库存",
                value: "InventoryTransferOrder"
            }, {
                name: "盘点库存",
                value: "InventoryCheckOrder"
            }, {
                name: "采购单",
                value: "ProcurementPayOrder"
            }, {
                name: "角色管理",
                value: "Role"
            }, {
                name: "员工管理",
                value: "Provider"
            }, {
                name: "系统开关配置",
                value: "SystemSwitchConfig"
            }, {
                name: "网电咨询",
                value: "OnlineConsult"
            }, {
                name: "随访规则管理",
                value: "FollowupRule"
            }, {
                name: "数据导出",
                value: "DataExport"
            }, {
                name: "批量操作",
                value: "BatchOperation"
            }, ];
            s.isAppointmentResourceEnabled() && t.logModules.push({
                name: "号源管理",
                value: "ProviderResource"
            });
            u.isRootGroup && u.isGroup && (t.selectedOfficeIdsArray = [u.officeId], e.getSelfAndChildOfficesByGroupId(u.officeId, !1).success(n => {
                t.officeTreeData = o.setId(n), t.isShowOfficeSelector = !0
            }))
        },
        v = function(n) {
            t.selectedOfficeIdsArray = _.pluck(n, "officeId");
            t.selectedOfficeIdsArray && t.selectedOfficeIdsArray.length > 0 && (t.initProviderDropDown(t.selectedOfficeIdsArray[0]), t.userId = null)
        };
    (function() {
        t.memoData = {};
        t.pageSize = 20;
        t.pageIndex = 1;
        t.refreshListData = c;
        t.onOfficeSelected = v;
        a()
    })()
}]);
securityModule.directive("deviceApplicationView", ["$log", "$window", "$modal", "$timeout", "$q", "patientUtil", "kendoUtil", "enums", "dataDicSvc", "loginContext", "aresDialog", "aresNotification", "revisitSvc", "aresSlidePanel", function(n, t, i, r, u, f, e, o, s, h, c, l) {
    "use strict";
    return {
        templateUrl: "/app/security/views/device-application-view.html",
        controller: "DeviceApplicationCtrl",
        link: function(n, i) {
            var nt = Ares.kendoGridUtil(t, n),
                f, h = function() {
                    f = i.find("#approvalStatus").kendoDropDownList({
                        dataSource: [{
                            name: "全部申请状态",
                            value: -1
                        }, {
                            name: "等待",
                            value: 1
                        }, {
                            name: "通过",
                            value: 2
                        }, {
                            name: "拒绝",
                            value: 3
                        }],
                        dataTextField: "name",
                        dataValueField: "value",
                        template: "#: name # ",
                        valueTemplate: "#: name #",
                        select: function(t) {
                            var i = this;
                            r(function() {
                                n.approvalStatus = i.dataItem(t.item)[i.options.dataValueField]
                            })
                        }
                    }).data("kendoDropDownList")
                },
                c = [{
                    field: "approvalStatusStr",
                    title: "申请状态",
                    width: "70px",
                    attributes: {
                        "class": "cell-center"
                    },
                    template: function(n) {
                        return n.approvalStatusStr
                    }
                }, {
                    field: "applicationTime",
                    title: "申请日期",
                    width: "130px",
                    template: function(n) {
                        return e.datetimeFormat(n.applicationTime)
                    }
                }, {
                    field: "applicationUser",
                    title: "申请员工",
                    width: "70px"
                }, {
                    field: "officeStr",
                    title: "设备归属",
                    width: "110px"
                }, {
                    field: "deviceCategoryStr",
                    title: "设备性质",
                    width: "70px"
                }, {
                    field: "deviceTypeStr",
                    title: "设备类型",
                    width: "70px"
                }, {
                    field: "deviceCode",
                    title: "设备标识",
                    width: "130px"
                }, {
                    field: "location",
                    title: "设备位置",
                    width: "130px"
                }, {
                    field: "authTypeStr",
                    title: "授权性质",
                    width: "70px"
                }, {
                    field: "authScopeStr",
                    title: "授权范围",
                    width: "110px"
                }, {
                    field: "applicationNotes",
                    title: "申请留言",
                    width: "130px"
                }, {
                    field: "approvalUser",
                    title: "审批人",
                    width: "70px"
                }, {
                    field: "",
                    title: "操作",
                    width: "100px",
                    template: function(n) {
                        var t = "";
                        return n.approvalStatus == 1 ? (t += '<span class="application-status" style="color:#00a6c9;cursor:pointer;" status="pass" dataId="' + n.id + '">通过<\/span>', t += '<span class="application-status" style="color:#00a6c9;cursor:pointer;margin-left:10px;" status="reject" dataId="' + n.id + '">拒绝<\/span>') : n.approvalStatus == 3 && (t += '<span class="application-status" style="color:#00a6c9;cursor:pointer;margin-left:10px;" status="callback" dataId="' + n.id + '">撤销<\/span>'), t
                    }
                }, ],
                o = null,
                u = function(r) {
                    n.refreshApplications(r).then(function(n) {
                        var r, u, f;
                        o = angular.copy(c);
                        r = i.find("#deviceApplicationGrid");
                        r.html("");
                        u = t.innerHeight - 205 - (window.Ares3 ? 30 : 0);
                        f = r.kendoGrid({
                            excel: {
                                allPages: !0
                            },
                            dataSource: {
                                data: n.items
                            },
                            height: u,
                            model: {
                                id: "id"
                            },
                            columns: o,
                            sortable: !1,
                            resizable: !0,
                            reorderable: !0,
                            columnMenu: !1,
                            columnMenuInit: function(n) {
                                n.container.find(".k-sort-asc").remove();
                                n.container.find(".k-sort-desc").remove();
                                var t = $(n.container).find(".k-menu-group");
                                t.find("li").each(function(n, t) {
                                    var i = $(t).text();
                                    i == " " && $(t).remove()
                                })
                            }
                        }).data("kendoGrid");
                        f.table.on("click", ".application-status", k)
                    })
                },
                a = function(t) {
                    n.pageIndex = t;
                    u()
                },
                v = function(t) {
                    n.pageSize = t;
                    u()
                },
                y = function() {
                    h();
                    n.initDefaultData();
                    u()
                },
                p = function(t) {
                    n.approve(t).then(function(n) {
                        n ? (l.success("审批成功！"), u()) : l.error("审批失败！")
                    })
                },
                w = function(t) {
                    n.reject(t).then(function(n) {
                        n ? (l.success("已拒绝！"), u()) : l.error("拒绝失败！")
                    })
                },
                b = function(t) {
                    n.callback(t).then(function(n) {
                        n ? (l.success("已撤销！"), u()) : l.error("撤销失败！")
                    })
                },
                k = function() {
                    var n = $(this).attr("dataId"),
                        t = $(this).attr("status");
                    t == "pass" ? p(n) : t == "reject" ? w(n) : t == "callback" && b(n)
                },
                d = function() {
                    n.approvalStatus = null;
                    n.applicationDate = "";
                    n.userId = 0;
                    f.value(-1);
                    u(1)
                },
                g = function() {
                    u(1)
                };
            (function() {
                n.onPageChanged = a;
                n.onPageSizeChanged = v;
                n.refresh = d;
                n.search = g;
                s.userNameDic.load().then(function() {
                    y()
                })
            })()
        }
    }
}]);
securityModule.directive("deviceHomeView", ["$log", "$timeout", "appNav", "practiceSvc", "officeSvc", "moduleOptionProvider", "loginContext", function(n, t, i) {
    "use strict";
    return {
        restrict: "E",
        templateUrl: "/app/security/views/device-home-view.html",
        link: function(n) {
            var t = function() {
                    var t = [new i.TabItem("securityCenter.device.deviceMgmt", "设备管理", "", "deviceSecurity.management"), new i.TabItem("securityCenter.device.deviceApplication", "设备审批", "", "deviceSecurity.application"), ];
                    n.states = t
                },
                r = function() {
                    i.switchState("securityCenter.device.deviceMgmt", "")
                };
            (function() {
                t();
                r()
            })()
        }
    }
}]);
securityModule.directive("deviceManagementEditView", ["$log", "$q", "$timeout", function(n, t, i) {
    return {
        replace: !0,
        templateUrl: "/app/security/views/device-management-edit-view.html",
        link: function(n, t) {
            var r = function() {
                    t.parents(".modal-dialog").css("width", "576px");
                    i(function() {
                        Ares.centerModal(t.closest(".modal-dialog"))
                    }, 50)
                },
                u = function() {
                    t.find("#deviceType").kendoDropDownList({
                        dataSource: [{
                            name: "电脑",
                            value: 1
                        }, {
                            name: "手机",
                            value: 2
                        }, {
                            name: "平板电脑",
                            value: 3
                        }],
                        optionLabel: "请选择",
                        dataTextField: "name",
                        dataValueField: "value",
                        template: "#: name # ",
                        valueTemplate: "#: name #",
                        value: n.device.deviceType,
                        select: function(t) {
                            var r = this;
                            i(function() {
                                n.device.deviceType = r.dataItem(t.item)[r.options.dataValueField]
                            })
                        }
                    }).data("kendoDropDownList")
                };
            (function() {
                r();
                n.initData().then(function() {
                    u()
                })
            })()
        }
    }
}]);
securityModule.directive("deviceManagementView", ["$log", "$window", "$modal", "$timeout", "$q", "patientUtil", "kendoUtil", "enums", "dataDicSvc", "loginContext", "aresDialog", "aresNotification", "revisitSvc", "aresSlidePanel", function(n, t, i, r, u, f, e, o, s, h, c, l) {
    "use strict";
    return {
        templateUrl: "/app/security/views/device-management-view.html",
        controller: "DeviceManagementCtrl",
        link: function(n, u) {
            var tt = Ares.kendoGridUtil(t, n),
                h, a = function() {
                    h = u.find("#deviceType").kendoDropDownList({
                        dataSource: [{
                            name: "全部设备",
                            value: -1
                        }, {
                            name: "电脑",
                            value: 1
                        }, {
                            name: "手机",
                            value: 2
                        }, {
                            name: "平板电脑",
                            value: 3
                        }],
                        dataTextField: "name",
                        dataValueField: "value",
                        template: "#: name # ",
                        valueTemplate: "#: name #",
                        select: function(t) {
                            var i = this;
                            r(function() {
                                n.deviceType = i.dataItem(t.item)[i.options.dataValueField];
                                o()
                            })
                        }
                    }).data("kendoDropDownList")
                },
                v = [{
                    field: "officeStr",
                    title: "设备归属",
                    width: "70px",
                    attributes: {
                        "class": "cell-center"
                    }
                }, {
                    field: "deviceStatusStr",
                    title: "设备状态",
                    width: "70px"
                }, {
                    field: "deviceCategoryStr",
                    title: "设备性质",
                    width: "70px"
                }, {
                    field: "deviceTypeStr",
                    title: "设备类型",
                    width: "70px"
                }, {
                    field: "deviceCode",
                    title: "设备标识",
                    width: "130px"
                }, {
                    field: "location",
                    title: "设备位置",
                    width: "130px"
                }, {
                    field: "authTypeStr",
                    title: "授权性质",
                    width: "70px"
                }, {
                    field: "authScopeStr",
                    title: "授权范围",
                    width: "110px"
                }, {
                    field: "expiredDate",
                    title: "授权有效日期",
                    width: "130px",
                    template: function(n) {
                        return e.dateFormat(n.expiredDate)
                    }
                }, {
                    field: "registryTime",
                    title: "登记日期",
                    width: "130px",
                    template: function(n) {
                        return e.datetimeFormat(n.registryTime)
                    }
                }, {
                    field: "registerUser",
                    title: "登记员工",
                    width: "70px"
                }, {
                    field: "",
                    title: "操作",
                    width: "100px",
                    template: function(n) {
                        var t = n.isDisabled ? "启用" : "停用",
                            i = '<span class="edit-button" style="color:#00a6c9;cursor:pointer;" dataId="' + n.id + '">编辑&nbsp;&nbsp;<\/span>';
                        return i + ('<span class="device-status" style="color:#00a6c9;cursor:pointer;" status="' + n.isDisabled + '" dataId="' + n.id + '">' + t + "<\/span>")
                    }
                }, ],
                c = null,
                f = function(i) {
                    n.refreshDevice(i).then(function(n) {
                        var i, f, r;
                        c = angular.copy(v);
                        i = u.find("#deviceManagementGrid");
                        i.html("");
                        f = t.innerHeight - 205 - (window.Ares3 ? 30 : 0);
                        r = i.kendoGrid({
                            excel: {
                                allPages: !0
                            },
                            dataSource: {
                                data: n.items
                            },
                            height: f,
                            model: {
                                id: "id"
                            },
                            columns: c,
                            sortable: !1,
                            resizable: !0,
                            reorderable: !0,
                            columnMenu: !1,
                            columnMenuInit: function(n) {
                                n.container.find(".k-sort-asc").remove();
                                n.container.find(".k-sort-desc").remove();
                                var t = $(n.container).find(".k-menu-group");
                                t.find("li").each(function(n, t) {
                                    var i = $(t).text();
                                    i == " " && $(t).remove()
                                })
                            }
                        }).data("kendoGrid");
                        r.table.on("click", ".device-status", d);
                        r.table.on("click", ".edit-button", g)
                    })
                },
                y = function(t) {
                    n.pageIndex = t;
                    f()
                },
                p = function(t) {
                    n.pageSize = t;
                    f()
                },
                w = function() {
                    a();
                    f()
                },
                b = function(t) {
                    n.enableDevice(t).then(function(n) {
                        n ? (l.success("操作成功！"), f()) : l.error("操作失败！")
                    })
                },
                k = function(t) {
                    n.disableDevice(t).then(function(n) {
                        n ? (l.success("操作成功！"), f()) : l.error("操作失败！")
                    })
                },
                d = function() {
                    var n = $(this).attr("dataId"),
                        t = $(this).attr("status");
                    t == "true" || t == !0 ? b(n) : k(n)
                },
                g = function() {
                    var n = $(this).attr("dataId"),
                        t = i.open({
                            animation: !0,
                            backdrop: "static",
                            template: "<device-management-edit-view><\/device-management-edit-view>",
                            controller: "DeviceManagementEditCtrl",
                            backdropClass: "ares-modal-backdrop",
                            resolve: {
                                host: function() {
                                    return {
                                        id: n
                                    }
                                }
                            }
                        });
                    t.result.then(function(n) {
                        n && o()
                    })
                },
                nt = function() {
                    n.deviceType = -1;
                    n.authType = 1;
                    h.value(-1);
                    f(1)
                },
                o = function(t) {
                    n.authType = t;
                    f(1)
                };
            (function() {
                n.onPageChanged = y;
                n.onPageSizeChanged = p;
                n.refresh = nt;
                n.search = o;
                s.userNameDic.load().then(function() {
                    w()
                })
            })()
        }
    }
}]);
securityModule.directive("loginLogListView", ["$log", "$window", "$timeout", "$q", "multiOfficeDataDic", "kendoUtil", "loginContext", "aresNotification", function(n, t, i, r, u, f, e, o) {
    "use strict";
    return {
        templateUrl: "/app/security/views/login-log-list-view.html",
        controller: "LoginLogListCtrl",
        link: function(n, r) {
            var c, l, a, s, h = function(t) {
                    u.loadDic(t, "currentOfficeWorkProviderDic").then(function(t) {
                        t = _.filter(t, function(n) {
                            return n.userID > 0
                        });
                        angular.forEach(t, function(n) {
                            n.fullName = n.name + "(" + n.employeeNo + ")"
                        });
                        s ? s.setDataSource(t) : s = r.find("#provider").kendoNameCodeFilterDropDownList({
                            optionLabel: "全部员工",
                            dataSource: t,
                            dataTextField: "fullName",
                            dataValueField: "userID",
                            filter: "contains",
                            change: function(t) {
                                var r = this;
                                i(function() {
                                    n.userId = r.dataItem(t.item)[r.options.dataValueField]
                                })
                            }
                        }).data("kendoNameCodeFilterDropDownList")
                    })
                },
                p = function() {
                    c = r.find("#logStatus").kendoDropDownList({
                        dataSource: [{
                            name: "成功",
                            value: "success"
                        }, {
                            name: "失败",
                            value: "fail"
                        }],
                        dataTextField: "name",
                        dataValueField: "value",
                        optionLabel: "全部状态",
                        select: function(t) {
                            var r = this;
                            i(function() {
                                n.state = r.dataItem(t.item)[r.options.dataValueField]
                            })
                        }
                    }).data("kendoDropDownList")
                },
                w = function() {
                    l = r.find("#logPlatform").kendoDropDownList({
                        dataSource: [{
                            name: "口腔SaaS",
                            value: "SaaS"
                        }, {
                            name: "APP",
                            value: "Mobile"
                        }, {
                            name: "SaaSApi",
                            value: "SaaSApi"
                        }, {
                            name: "未知",
                            value: "Unknown"
                        }, ],
                        dataTextField: "name",
                        dataValueField: "value",
                        optionLabel: "全部平台",
                        select: function(t) {
                            var r = this;
                            i(function() {
                                n.platform = r.dataItem(t.item)[r.options.dataValueField]
                            })
                        }
                    }).data("kendoDropDownList")
                },
                b = function() {
                    a = r.find("#logAction").kendoDropDownList({
                        dataSource: [{
                            name: "登录",
                            value: "LogOn"
                        }, {
                            name: "注销",
                            value: "LogOff"
                        }, ],
                        dataTextField: "name",
                        dataValueField: "value",
                        optionLabel: "全部类型",
                        select: function(t) {
                            n.action = this.dataItem(t.item)[this.options.dataValueField] || null
                        }
                    }).data("kendoDropDownList")
                },
                k = [{
                    field: "recordCreatedTimeStr",
                    title: "登录时间",
                    width: "150px"
                }, {
                    field: "officeName",
                    title: "登录诊所",
                    width: "100px"
                }, {
                    field: "actionStr",
                    title: "登录类型",
                    width: "60px"
                }, {
                    field: "platformStr",
                    title: "登录平台",
                    width: "80px"
                }, {
                    field: "deviceCode",
                    title: "设备标识",
                    width: "150px"
                }, {
                    field: "ip",
                    title: "客户端IP",
                    width: "100px"
                }, {
                    field: "employeeNo",
                    title: "工号",
                    width: "100px"
                }, {
                    field: "providerName",
                    title: "员工",
                    width: "100px"
                }, {
                    field: "state",
                    title: "状态",
                    width: "60px"
                }, {
                    field: "logOnStateStr",
                    title: "说明",
                    width: "100px"
                }, ],
                v = null,
                f = function(i) {
                    n.refreshListData(i).then(function(n) {
                        var i, u, f;
                        v = angular.copy(k);
                        i = r.find("#logListGrid");
                        i.html("");
                        u = t.innerHeight - 160 - (window.Ares3 ? 70 : 0);
                        f = i.kendoGrid({
                            excel: {
                                allPages: !0
                            },
                            dataSource: {
                                data: n.items
                            },
                            height: u,
                            model: {
                                id: "id"
                            },
                            columns: v,
                            sortable: !1,
                            resizable: !0,
                            reorderable: !0,
                            columnMenu: !1,
                            columnMenuInit: function(n) {
                                n.container.find(".k-sort-asc").remove();
                                n.container.find(".k-sort-desc").remove();
                                var t = $(n.container).find(".k-menu-group");
                                t.find("li").each(function(n, t) {
                                    var i = $(t).text();
                                    i == " " && $(t).remove()
                                })
                            }
                        }).data("kendoGrid")
                    })
                },
                d = function(t) {
                    n.pageIndex = t;
                    f()
                },
                g = function(t) {
                    n.pageSize = t;
                    f()
                },
                nt = function() {
                    p();
                    w();
                    b();
                    h(e.officeId);
                    y();
                    f(!1)
                },
                tt = function() {
                    n.state = null;
                    n.platform = null;
                    n.action = null;
                    n.userId = null;
                    n.isShowOfficeSelector && (n.selectedOfficeIdsArray = [e.officeId], h(e.officeId));
                    c.value(null);
                    l.value(null);
                    a.value(null);
                    s.value(null);
                    f(1)
                },
                it = function() {
                    var t = moment(n.startTime),
                        i = moment(n.endTime),
                        r = i.diff(t, "days");
                    r > 7 ? o.error("起止时间差值不允许超过7天") : f(1)
                },
                y = function() {
                    var t = moment().format("YYYY-MM-DD"),
                        i = moment().add(1, "day").format("YYYY-MM-DD");
                    n.startTime = t;
                    n.endTime = i;
                    n.timeSpan = {
                        startDate: t,
                        endDate: i
                    }
                },
                rt = function(t) {
                    t = t || n.timeSpan;
                    n.startTime = moment(t.startDate).format("YYYY-MM-DD");
                    n.endTime = moment(t.endDate).add(1, "day").format("YYYY-MM-DD")
                };
            (function() {
                n.onPageChanged = d;
                n.onPageSizeChanged = g;
                n.refresh = tt;
                n.search = it;
                n.initTimeSpan = y;
                n.onDateRangeChanged = rt;
                n.initProviderDropDown = h;
                n.itemType = "备忘录主题";
                nt()
            })()
        }
    }
}]);
securityModule.directive("securityCenterView", ["$log", "$timeout", "$modal", "$state", "appNav", "enums", "eventAggregator", function(n, t, i, r, u) {
    "use strict";
    return {
        restrict: "E",
        templateUrl: "/app/security/views/security-center-view.html",
        scope: {},
        link: function(n) {
            var t = function(n) {
                    u.switchState(n, i)
                },
                i = function() {
                    var t = n.patientId;
                    return {
                        patientId: t
                    }
                };
            (function() {
                n.switchState = t
            })()
        }
    }
}]);
securityModule.directive("securityDataSettingView", ["$log", "$window", "$timeout", "$q", "$modal", "multiOfficeDataDic", "kendoUtil", "loginContext", "aresNotification", function() {
    "use strict";
    return {
        templateUrl: "/app/security/views/security-data-setting-view.html",
        controller: "SecurityDataSettingCtrl",
        link: function(n) {
            var t = function() {
                    n.saveOption().then(function() {
                        n.isEdit = !1
                    })
                },
                i = function() {
                    n.isEdit = !n.isEdit
                },
                r = function() {
                    n.initData();
                    n.isEdit = !1
                };
            (function() {
                n.editConfig = i;
                n.save = t;
                n.cancel = r;
                n.isEdit = !1;
                n.initData();
                n.isAres3 = window.Ares3
            })()
        }
    }
}]);
var security;
(function() {
    var n = function() {
        function n(n) {
            this.$timeout = n;
            this.restrict = "E";
            this.replace = !0;
            this.templateUrl = "/app/security/views/security-error-log-view.html";
            this.controller = "SecurityErrorLogCtrl";
            this.link = function() {
                (function() {})()
            }
        }
        return n.$inject = ["$timeout"], n
    }();
    supplychainModule.directive("securityErrorLogView", Ares.tsDirective(n))
})(security || (security = {}));
securityModule.directive("securityOperationLogListView", ["$log", "$window", "$timeout", "$q", "$modal", "multiOfficeDataDic", "kendoUtil", "loginContext", "aresNotification", function(n, t, i, r, u, f, e, o, s) {
    "use strict";
    return {
        templateUrl: "/app/security/views/security-operation-log-list-view.html",
        controller: "SecurityOperationLogListCtrl",
        link: function(n, r) {
            var l, a, h, c = function(t) {
                    f.loadDic(t, "currentOfficeWorkProviderDic").then(function(t) {
                        t = _.filter(t, function(n) {
                            return n.userID > 0
                        });
                        angular.forEach(t, function(n) {
                            n.fullName = n.name + "(" + n.employeeNo + ")"
                        });
                        h ? h.setDataSource(t) : h = r.find("#provider").kendoNameCodeFilterDropDownList({
                            optionLabel: "全部员工",
                            dataSource: t,
                            dataTextField: "fullName",
                            dataValueField: "userID",
                            filter: "contains",
                            change: function(t) {
                                var r = this;
                                i(function() {
                                    n.userId = r.dataItem(t.item)[r.options.dataValueField]
                                })
                            }
                        }).data("kendoNameCodeFilterDropDownList")
                    })
                },
                p = function() {
                    l = r.find("#logModules").kendoDropDownList({
                        dataSource: n.logModules,
                        dataTextField: "name",
                        dataValueField: "name",
                        optionLabel: "全部模块",
                        select: function(t) {
                            var r = this;
                            i(function() {
                                n.moduleLevelOne = r.dataItem(t.item)[r.options.dataValueField]
                            })
                        }
                    }).data("kendoDropDownList")
                },
                w = function() {
                    a = r.find("#operationType").kendoDropDownList({
                        dataSource: [{
                            name: "新增",
                            value: "增"
                        }, {
                            name: "修改",
                            value: "改"
                        }, {
                            name: "删除",
                            value: "删"
                        }, {
                            name: "查看",
                            value: "查"
                        }],
                        dataTextField: "name",
                        dataValueField: "value",
                        optionLabel: "全部类型",
                        select: function(t) {
                            n.operationType = this.dataItem(t.item)[this.options.dataValueField] || null
                        }
                    }).data("kendoDropDownList")
                },
                b = [{
                    field: "recordCreatedTimeStr",
                    title: "操作时间",
                    width: "150px"
                }, {
                    field: "officeName",
                    title: "登录诊所",
                    width: "100px"
                }, {
                    field: "employeeNo",
                    title: "工号",
                    width: "100px"
                }, {
                    field: "providerName",
                    title: "员工",
                    width: "100px"
                }, {
                    field: "moduleLevelOne",
                    title: "操作模块",
                    width: "100px"
                }, {
                    field: "operationTypeStr",
                    title: "操作类型",
                    width: "100px"
                }, {
                    field: "moduleLevelTwo",
                    title: "操作行为",
                    width: "100px"
                }, {
                    field: "",
                    title: "操作",
                    width: "100px",
                    template: function(n) {
                        var t = n.id,
                            i = n.recordId,
                            r = n.module;
                        return '<span class="enyo-text-primary show-detail" dataId="' + t + '" recordId="' + i + '" module="' + r + '">查看明细<\/span>'
                    }
                }, ],
                v = null,
                e = function(i) {
                    n.refreshListData(i).then(function(n) {
                        var i, u, f;
                        v = angular.copy(b);
                        i = r.find("#memoListGrid");
                        i.html("");
                        u = t.innerHeight - 160 - (window.Ares3 ? 70 : 0);
                        f = i.kendoGrid({
                            excel: {
                                allPages: !0
                            },
                            dataSource: {
                                data: n.items
                            },
                            height: u,
                            model: {
                                id: "id"
                            },
                            columns: v,
                            sortable: !1,
                            resizable: !0,
                            reorderable: !0,
                            columnMenu: !1,
                            columnMenuInit: function(n) {
                                n.container.find(".k-sort-asc").remove();
                                n.container.find(".k-sort-desc").remove();
                                var t = $(n.container).find(".k-menu-group");
                                t.find("li").each(function(n, t) {
                                    var i = $(t).text();
                                    i == " " && $(t).remove()
                                })
                            }
                        }).data("kendoGrid");
                        f.table.on("click", ".show-detail", g)
                    })
                },
                k = function(t) {
                    n.pageIndex = t;
                    e()
                },
                d = function(t) {
                    n.pageSize = t;
                    e()
                },
                g = function() {
                    var i = $(this).attr("dataId"),
                        t = $(this).attr("recordId"),
                        n = $(this).attr("module"),
                        r = parseInt(t) ? t : i,
                        f;
                    n == "Membership" && (r = i);
                    parseInt(t) || n != "MedicalRecord" || (n = "");
                    f = u.open({
                        animation: !0,
                        backdrop: "static",
                        template: "<operation-log-list-view><\/operation-log-list-view>",
                        controller: "OperationLogListCtrl",
                        size: "lg",
                        windowClass: "operation-log-dialog",
                        resolve: {
                            host: function() {
                                return {
                                    id: r,
                                    type: n
                                }
                            }
                        }
                    })
                },
                nt = function() {
                    p();
                    w();
                    c(o.officeId);
                    y();
                    e(!1)
                },
                tt = function() {
                    n.moduleLevelOne = null;
                    n.operationType = null;
                    n.isShowOfficeSelector && (n.selectedOfficeIdsArray = [o.officeId], c(o.officeId));
                    l.value(null);
                    a.value(null);
                    h.value(null);
                    n.userId = null;
                    e(1)
                },
                it = function() {
                    var t = moment(n.startTime),
                        i = moment(n.endTime),
                        r = i.diff(t, "days");
                    r > 7 ? s.error("起止时间差值不允许超过7天") : e(1)
                },
                y = function() {
                    var t = moment().format("YYYY-MM-DD"),
                        i = moment().add(1, "day").format("YYYY-MM-DD");
                    n.startTime = t;
                    n.endTime = i;
                    n.timeSpan = {
                        startDate: t,
                        endDate: i
                    }
                },
                rt = function(t) {
                    t = t || n.timeSpan;
                    n.startTime = moment(t.startDate).format("YYYY-MM-DD");
                    n.endTime = moment(t.endDate).add(1, "day").format("YYYY-MM-DD")
                };
            (function() {
                n.onPageChanged = k;
                n.onPageSizeChanged = d;
                n.refresh = tt;
                n.search = it;
                n.initTimeSpan = y;
                n.onDateRangeChanged = rt;
                n.initProviderDropDown = c;
                n.itemType = "备忘录主题";
                nt()
            })()
        }
    }
}]);